/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package app.controller;

import app.business.CourseSessionBean;
import app.entity.Courses;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 *
 * @author DangThanh
 */
@ManagedBean(name = "courseManagedBean")
@SessionScoped
public class CourseManagedBean {

    @EJB
    private CourseSessionBean courseSessionBean;
    private Courses course;

    public Courses getCourse() {
        return course;
    }

    public void setCourse(Courses course) {
        this.course = course;
    }

    /**
     * Creates a new instance of CourseManagedBean
     */
    public CourseManagedBean() {
        course = new Courses();
    }

    public List<Courses> getCourses() {
        return courseSessionBean.getAllCourse();
    }

    public void addCourse() {
        course = courseSessionBean.addCourse(course);
    }
}
